package com.authine.cloudpivot.web.api.service;

import com.alibaba.dubbo.config.annotation.Reference;
import com.authine.cloudpivot.engine.api.facade.TaskReportFacade;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: zyj
 * @time: 2021/7/1 17:22
 */
@Service
public class AsyncDataService {

    @Reference(version = "1.00")
    private TaskReportFacade taskReportFacade;

//    @Autowired
//    private ExecuteService executeService; // service 没有被使用,放在这里导致启动时报循环依赖错误

    @Async
    public void getXiaFaDataLejuanAsync() {
        try {
            Thread.sleep(8000);
            taskReportFacade.getXiaFaDataLejuan();
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {

        }
    }

    @Async
    public void createZiJianQCReportAsync(){
        try {
            Thread.sleep(8000);
            taskReportFacade.createZiJianQCReport();
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {

        }
    }

    @Async
    public void updateSampleList(){
        try {
            Thread.sleep(8000);
            taskReportFacade.updateSampleList();
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {

        }
    }

    @Async
    public void getSubjectCode(){
        try {
            Thread.sleep(20000);
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {

        }
    }


    @Async
    public void clearFASQ(String id){
        try {
            Thread.sleep(8000);
            taskReportFacade.clearFASQ(id);
        }catch (InterruptedException e){
            e.printStackTrace();
        }finally {

        }
    }
}
